package commands;


import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.swt.widgets.List;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.custom.StyledText;

public class Help extends Composite {

	private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());

	/**
	 * Create the composite.
	 * @param parent
	 * @param style
	 */
	public Help(Composite parent, int style) {
		super(parent, style);
		addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent e) {
				toolkit.dispose();
			}
		});
		toolkit.adapt(this);
		toolkit.paintBordersFor(this);
		setLayout(new FormLayout());
		
		Composite composite = new Composite(this, SWT.NONE);
		FormData fd_composite = new FormData();
		fd_composite.top = new FormAttachment(0, 10);
		fd_composite.left = new FormAttachment(0, 10);
		fd_composite.bottom = new FormAttachment(0, 437);
		fd_composite.right = new FormAttachment(0, 428);
		composite.setLayoutData(fd_composite);
		toolkit.adapt(composite);
		toolkit.paintBordersFor(composite);
		
		String helpMessage = "ADD\n" +
				"add <description> : <deadline>\n" +
				"eg. add assignment : today\n" +
				"\n" +
				"EDIT\n" +
				"edit <index> : <field> : <new value>\n" +
				"eg. edit 1 : titl : new assignment" +
				"\n" +
				"COMPLETE\n" +
				"complete <index>\n" +
				"eg. complete 1\n" +
				"\n" +
				"REMOVE\n" +
				"remove <index>\n" +
				"eg. remove 1\n" +
				"LIST\n" +
				"list\n" +
				"\n" +
				"QUIT\n" +
				"quit\n" +
				"\n" +
				"ADVANCE USAGE\n" +
				"SEARCH\n" +
				"search <keyword> : <period of time>\n" +
				"format for <period of time> : \n" +
				"from <date> to <date>\n" +
				"to <date>\n" +
				"from <date>\n" +
				"before <date>\n" +
				"on <date>\n" +
				"\n" +
				"eg. search proj from 3 nov to 7 nov\n" +
				"\n" +
				"UNDO\n" +
				"undo\n" +
				"REDO\n" +
				"redo\n" +
				"\n" +
				"REPEAT TASK\n" +
				"<repetition> starting <first occurence>\n" +
				"format for <first occurence>:\n" +
				"" +
				"";
		StyledText styledText = new StyledText(composite, SWT.BORDER);
		styledText.setText(helpMessage);
		styledText.setBounds(10, 10, 383, 395);
		toolkit.adapt(styledText);
		toolkit.paintBordersFor(styledText);

	}
}
